package com.example.shop2021.controller;

import com.example.shop2021.DO.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;


import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;

@Controller
@RequestMapping("/user")
public class UserController {
    @RequestMapping("/getAllUser")
    public String getAllUser(HttpServletRequest request,Model model){
        ArrayList<User> userList = new ArrayList<>();
        for (int i=0;i<10;i++){
            User u = new User();
            u.setUsername("test" + i);
            u.setPasswd("test" + i);
            userList.add(u);
        }
        //request.setAttribute("userList",userList);
        model.addAttribute("userList",userList);
        return "userList";
    }
}
